<?php
	class Stats {
		
		public $nrClients;
		public $nrFirms;
		public $nrAddresses;
		public $nrComenzi;
		
		public function __construct($nrClients, $nrFirms, $nrAddresses, $nrComenzi) {
			$this->nrClients = $nrClients;
			$this->nrFirms = $nrFirms;
			$this->nrAddresses = $nrAddresses;
			$this->nrComenzi = $nrComenzi;	
		}
		
		public static function getBasicStats($db) {
			$query = "SELECT COUNT(id) AS nr_firme FROM firme";	
			$result = $db->query($query);
			$data = $result->fetch(PDO::FETCH_ASSOC);        
			$nr_firme = $data['nr_firme'];
			
			$query = "SELECT COUNT(id) AS nr_clienti FROM client";	
			$result = $db->query($query);
			$data = $result->fetch(PDO::FETCH_ASSOC);        
			$nr_clienti = $data['nr_clienti'];
			
			$query = "SELECT COUNT(id) AS nr_adrese FROM adresa";	
			$result = $db->query($query);
			$data = $result->fetch(PDO::FETCH_ASSOC);        
			$nr_adrese = $data['nr_adrese'];
						
			$query = "SELECT COUNT(id) AS nr_comenzi FROM comanda";	
			$result = $db->query($query);
			$data = $result->fetch(PDO::FETCH_ASSOC);        
			$nr_comenzi = $data['nr_comenzi'];        
			
	        return new Stats($nr_clienti, $nr_firme, $nr_adrese, $nr_comenzi);				
		}
		
		public static function getStatsPerClient($id_client) {
			
		}
	}
?>